<?php
	@session_start();
	include("../../connect/connect_mysql.php");
	
	$act= $_POST["act"];
 	switch($act){
 		case 'image_menu':
 			$id= 2;	
 		break;
 		case 'image_collection':
 			$id= 3;	
 		break;
		case 'image_event':
 			$id = 5;
		break;
		case 'image_banner':
			$id= 7;
 		break;
 		case 'image_header':
			$id= 8;
 		break;
 		case 'image_gallery':
			$id= 9;
 		break;
 		case 'image_onpress':
			$id= 10;
 		break;
 	}
 	$ids = $_POST['ids'];
	$query = "SELECT * FROM wheelhouse.image WHERE image_id in ($ids);";
	mysql_query ("SET NAMES 'utf8'");
 	$result = mysql_query($query) or die(mysql_error());
	$num_rows = mysql_num_rows($result);
	if ($num_rows > 0){		
		while($row = mysql_fetch_array($result)){
			$thumb = $row['thumb'];
			$path = $_SERVER['DOCUMENT_ROOT'] . "/wheelhouse/upload/thumb/".$thumb; 
			unlink($path);
		 }
		$query = "UPDATE `image` SET `is_deleted`= '1' WHERE page_id = $id and image_id IN ($ids);";
	 	mysql_query ("SET NAMES 'utf8'");
	 	$result = mysql_query($query) or die(mysql_error());
		echo 1;
	}else{
		echo 0;
	}

?>
	